package org.bpms.service.admin;

import java.util.UUID;

import org.bpms.model.admin.Booklog;

import com.jfinal.aop.Before;
import com.jfinal.plugin.activerecord.tx.Tx;

/**
 * 档案处理日志操作接口
 * @author hupei
 *
 */
public class BooklogService {
	@Before(Tx.class)
	public void save(Booklog log){
		if (null == log.get("id")){
			log.set("id", UUID.randomUUID().toString().replaceAll("-", ""));
			log.save();
		}
	}
	
	/**
	 * 得到档案最后一次的处理情况
	 * @param bookid
	 */
	public Booklog findLast(String bookid){
		String sql = "select * from booklog where bookid=? order by createtime desc";
		Booklog log = Booklog.me.findFirst(sql, bookid);
		return log;
	}
}
